package helper.scxml.scxml2.zone.t2

import helper.base.PrintHelper.StringTo.toPrintln
import helper.base.TupleHelper.GetTuple.getA2Tuple
import helper.base.debug.DebugHelper.DebuggerList.Companion.makeDebuggerList
import helper.base.debug.DebugRes.debug_t_2023_0809_015634_cal
import helper.scxml.strategy.StrategyHelper.TimedEventHelper.TimedEvent.Companion.toTimedEvent
import helper.scxml.scxml2.zone.t2.ConfigHelper.DoubleWeightedPathLHM
import helper.scxml.scxml2.zone.t2.ConfigHelper.DoubleWeightedPathLHM.Companion.getDoublePathLHM
import org.junit.Test

internal class ConfigHelperTest {
    @Test
    fun t1() {
        "1,sss".toTimedEvent().toString().toPrintln()
    }

    fun getTest1PathLHM(): DoubleWeightedPathLHM<String> {
        val pathLHM = getDoublePathLHM<String>(
            1.0,
            linkedMapOf(
                "t" to { 1.0 },
            ),
        )
        val zs1 = "zs1"
        val zs2 = "zs2"
        val zs3 = "zs3"
        val zs4 = "zs4"
        val zs5 = "zs5"
        val zs6 = "zs6"
        val zs7 = "zs7"
        val zs8 = "zs8"
        pathLHM[zs1] = arrayListOf(
            getA2Tuple(zs2, 1.0),
        )
        pathLHM[zs2] = arrayListOf(
            getA2Tuple(zs3, 2.0),
            getA2Tuple(zs4, 3.0),
        )
        pathLHM[zs3] = arrayListOf(
            getA2Tuple(zs5, 4.0),
        )
        pathLHM[zs4] = arrayListOf(
            getA2Tuple(zs6, 5.0),
            getA2Tuple(zs8, 8.0),
        )
        pathLHM[zs5] = arrayListOf(
            getA2Tuple(zs7, 6.0),
        )
        return pathLHM
    }

    @Test
    fun t_touch_print_PathLHM() {
        getTest1PathLHM().pln()
        //zs1,1.0
        //	zs2,1.0
        //		zs3,2.0
        //			zs5,4.0
        //				zs7,6.0
        //		zs4,3.0
        //			zs6,5.0
        //			zs8,8.0
    }

    @Test
    fun t111() {
        val debuggerList = makeDebuggerList()
        val test1PathLHM = getTest1PathLHM()
        debuggerList.d(
            debug_t_2023_0809_015634_cal,
        ) {
            test1PathLHM.pln()
        }
        val cal = test1PathLHM.cal()
        println(cal)
        val calString = test1PathLHM.getCalString()
        println(calString)
    }

    @Test
    fun t222() {
        val res =
            0 + ((1 * 1.0 / 1.0 * 1.0 / 5.0 * 2.0 / 4.0 * 4.0 / 6.0 * 6.0) * 1.0) + ((1 * 1.0 / 1.0 * 1.0 / 5.0 * 3.0 / 13.0 * 5.0) * 1.0) + ((1 * 1.0 / 1.0 * 1.0 / 5.0 * 3.0 / 13.0 * 8.0) * 1.0)
        println(res)
    }
}